package io.renren.modules.backstage.controller;

import io.renren.common.exception.StatusCode;
import io.renren.common.utils.Result;
import io.renren.modules.backstage.entity.FinanceEntity;
import io.renren.modules.backstage.service.FinanceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 财务报表controller
 */
@RestController
@RequestMapping("/finance")
@CrossOrigin
public class FinanceController {

    @Autowired
    FinanceService financeService;


    /**
     * 财务报表数据查询
     * @return
     */
    @GetMapping("/getAll")
    public Result getFinanceAllById(@RequestParam("parentId") Integer parentId){
       List<FinanceEntity> list= financeService.getFinanceAll(parentId);
    return  new Result(StatusCode.OK,"财务报表数据查询成功",true,list);
    }

    /**
     * 初始换数据
     */
    @GetMapping("/import")
    public Result imPort(){
        financeService.imPort();
        return  new Result(StatusCode.OK,"数据初始化成功",true);
    }
}
